﻿using Newtonsoft.Json.Linq;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace LNSServer.Models
{
    /// <summary>
    /// 报告表
    /// </summary>
    [SugarTable("report", TableDescription = "报告表")]
    public class ReportModel
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id", ColumnDescription = "主键ID")]
        public long Id { get; set; }

        /// <summary>
        /// 工程Id
        /// </summary>
        [SugarColumn(ColumnName = "pjid", ColumnDescription = "工程Id")]
        public long PjId { get; set; }

        /// <summary>
        /// 工程名称
        /// </summary>
        [SugarColumn(ColumnName = "pjname", ColumnDescription = "工程名称")]
        public string PjName { get; set; }

        /// <summary>
        /// 编号
        /// </summary>
        [SugarColumn(ColumnName = "number", ColumnDescription = "编号")]
        public string Number { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        [SugarColumn(ColumnName = "begintime", ColumnDescription = "开始时间")]
        public DateTime BeginTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        [SugarColumn(ColumnName = "endtime", ColumnDescription = "结束时间")]
        public DateTime EndTime { get; set; }

        /// <summary>
        /// 模拟持续时间(分钟)
        /// </summary>
        [SugarColumn(ColumnName = "simulationkeeptime", ColumnDescription = "模拟持续时间(分钟)")]
        public long SimulationKeepTime { get; set; }

        /// <summary>
        /// 原因
        /// </summary>
        [SugarColumn(ColumnName = "reason", ColumnDescription = "原因")]
        public string Reason { get; set; }

        /// <summary>
        /// 报告当时项目配置参数json
        /// </summary>
        [SugarColumn(ColumnName = "config", ColumnDataType = "json", IsJson = true, ColumnDescription = "报告当时项目配置参数json")]
        public JObject Config { get; set; }

        /// <summary>
        /// 详细信息json
        /// </summary>
        [SugarColumn(ColumnName = "details", ColumnDataType = "json", IsJson = true, ColumnDescription = "详细信息json")]
        public JArray Details { get; set; }

        /// <summary>
        /// 用户Id
        /// </summary>
        [SugarColumn(ColumnName = "uid", ColumnDescription = "用户Id")]
        public long UId { get; set; }

        /// <summary>
        /// 用户信息
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string RealName { get; set; }

        /// <summary>
        /// 是否激活数据 1-是 0-否
        /// </summary>
        [SugarColumn(ColumnName = "isactive", ColumnDescription = "是否激活数据 1-是 0-否")]
        public int IsActive { get; set; } = 1;

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "created", IsOnlyIgnoreUpdate = true)]
        public DateTime Created { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>        
        [SugarColumn(ColumnName = "updated")]
        public DateTime Updated { get; set; } = DateTime.Now;

    }
}
